/*
5 1 5
3 3 1 2 5

*/
/*
#include<bits/stdc++.h>
using namespace std;
const int N	 = 205;
int k[N];
int a, b, n;
int res = 1e9;
bool st[N]; 
void dfs(int x, int cnt)
{
	if (cnt >= res) return;
	if (x < 0 || x > n)  return;
	if (x == b)
	{
		res = min(res, cnt);
		return; 
	}
	if (x + k[x] <= n && !st[x + k[x]])
	{
		st[x + k[x]] = true;
		dfs(x + k[x], cnt + 1);
		st[x + k[x]] = false;
	}
	if (x - k[x] > 0 && !st[x - k[x]])
	{
		st[x - k[x]] = true;
		dfs(x - k[x], cnt + 1);
		st[x - k[x]] = false;
	}
}
int main()
{
	scanf("%d %d %d", &n, &a, &b);
	for (int i = 1; i <= n; i ++)
	{
		scanf("%d", &k[i]); 
	}
	dfs(a, 0);
	printf("%d", res); 
	return 0;
} 
*/




























